﻿using System.Configuration;
using System.Web.Mvc;
using DotNETStack.Core.Configuration;
using DotNETStack.Core.Data;

namespace DotNETStack.Web.UI.Controllers
{
    public class BaseController : Controller
    {
        #region Private Fields

        private readonly IDotNETStackConfiguration _config;

        #endregion

        #region Protected Properties

        protected IDataProvider DataProvider { get; private set; }

        #endregion

        #region Constructors

        public BaseController()
        {
            _config = (IDotNETStackConfiguration) ConfigurationManager.GetSection("DotNETStack");
            if (_config != null) DataProvider = _config.DataProvider.GetInstance();
        }

        #endregion
    }
}